package com.huike.pmps.controller;

import com.huike.pmps.model.entity.SupplierAttachment;
import com.huike.pmps.model.vo.Result;
import com.huike.pmps.service.SupplierAttachmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 作者：谌贵斌(黑桃K)
 * 日期: 2888-08-08
 * 老师QQ: 272488352
 * 官方QQ交流群: 377748272
 * 刀客程序员官网：http://www.daoke360.com
 * 刀客程序员淘宝旗舰店：https://daoke360.taobao.com/
 */
@Api(tags = "供应商附件管理")
@RestController
@RequestMapping("/api/supplier_attachments")
public class SupplierAttachmentController {

    @Autowired
    SupplierAttachmentService supplierAttachmentService;


    @ApiOperation(value = "获取供应商附件信息(按附件类型)", httpMethod = "GET")
    @GetMapping
    public Result selectByCondition(Integer supplierId, Integer type) {
        return supplierAttachmentService.selectByCondition(supplierId, type);
    }


    @ApiOperation(value = "获取供应商附件信息(获取所有)", httpMethod = "GET")
    @GetMapping("{supplierId}")
    public Result selectBySupplierId(@PathVariable("supplierId") Integer supplierId) {
        return supplierAttachmentService.selectByCondition(supplierId);
    }

    @ApiOperation(value = "根据附件ID删除供应商附件数据", httpMethod = "DELETE")
    @DeleteMapping("/{id}")
    public Result deleteById(@PathVariable("id") Integer id) {
        return supplierAttachmentService.deleteById(id);
    }


}
